<?php
class FormAction extends Action {
	
	// 添加
	public function insert() {
		$name = I ( 'post.name', '', 'htmlspecialchars' );
		$stu_id=I('post.stu_id','', 'htmlspecialchars');
		
		$date=C('DATE');
		$updatetime=I ( 'post.updatetime', '', 'htmlspecialchars' );
		$Student = D ( 'Student' );
		if ($date==$updatetime){
		if ($Student->create ()) {
			$result = $Student->add ();
			if ($result) {
				$this->success ( '学籍录入成功!欢迎你' );
			} else {
				$this->error ( $Student->getError ( '录入失败' ) );
			}
		} else {
			$this->error ( $Student->getError () );
		}
	}else {
		$this->error( "入学年份不对!年份只能是".C('DATE'));
	}
	}
	
	// 读取
	
	/*
	 * public function read1() { $Form = M ( 'Score' ); // 读取数据 $data = $Form->find ( $id ); if ($data) { $this->data = $data; // 模版变量赋值 } else { $this->error ( '没有该学生' ); } $this->display (); }
	 */
	// 更新
	/*
	 * public function edit($id=0){ $Form=M('Student'); $this->vo=$Form->find($id); $this->display(); } public function update(){ $Form=D('Student'); if($Form->create()){ $result=$Form->save(); if ($result){ $this->success('操作成功'); }else { $this->error('操作失败'); } }else { $this->error($Form->getError()); } } //删除 //$Form=M('Form'); //$Form->delete(5);
	 */
}